using UnityEngine;
using System.Collections;

public class EnemyCollisions : MonoBehaviour 
{
	public int score = 1;
	public GameObject explosion = null;
	
	void OnTriggerEnter(Collider other)
	{
		switch(other.tag)
		{
		case "Enemy":
			//Ignore collision between two enemies
			Physics.IgnoreCollision(gameObject.collider, other.collider);
			break;
			
		case "PlayerProjectile":
			//Create the explosion
			Instantiate(explosion, transform.position, Quaternion.identity);
			
			//Destroy the projectile
			Destroy(other.gameObject);
			
			//Call the enemy killed method from the game manager
			GameManager.EnemyKilled(score);
			
			//Destroy the enemy
			Destroy(gameObject);
			
			break;
		}
	}
}
